Skip to content

Install with fsverity enabled + required #935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

cgwalters
Copy link
Collaborator

@cgwalters cgwalters commented Dec 4, 2024

The goal of this PR is to align with this PR to ostree so that to to hard require fsverity for bootc install, and chain it to the ostree config, you can do e.g.:

RUN echo -e '[composefs]\nenabled=verity' > /usr/lib/ostree/prepare-root.conf

@github-actions github-actions bot added the area/install Issues related to `bootc install` label Dec 4, 2024
@cgwalters
Copy link
Collaborator Author

Needs a rebase, conflicts should be relatively straightforward to fix

@allisonkarlitskaya
Copy link
Contributor

Can you explain some scenarios where we might want to have fs-verity disabled? Is it just on filesystems that can't support it? Because even without checking the verity data or anything, I find the "this inode is now immutable" thing to be extremely compelling, particularly in the presence of multiple hardlinks....

@cgwalters
Copy link
Collaborator Author

Can you explain some scenarios where we might want to have fs-verity disabled? Is it just on filesystems that can't support it?

That's by far the biggest case.

However, there is some generic overhead to having it...this isn't quite as relevant for bootc but it would be for taking fsverity in container runtimes in general. There are people that disable selinux to claw back like 1-2% of performance and fsverity is a bit like that, you just have this cost to paging in new code and doing cryptographic verification.

But supporting deploying to filesystems without it is 94.3% of the rationale for bootc.

Because even without checking the verity data or anything, I find the "this inode is now immutable" thing to be extremely compelling, particularly in the presence of multiple hardlinks....

Definitely! Before composefs existed I was trying to push for fsverity in ostree just for this reason...but I struggled with tying it to a higher level integrity story. Thankfully we have that now!

@cgwalters cgwalters force-pushed the install-config-verity branch from 8379be7 to d045510 Compare December 10, 2024 20:40
@cgwalters cgwalters force-pushed the install-config-verity branch 3 times, most recently from 280cbe6 to b7cfe64 Compare January 9, 2025 21:01
@cgwalters
Copy link
Collaborator Author

TODO: Also check for ostreedev/ostree#3354 - if that's set then we should key off it too.

In fact, maybe that should be the sole interface for now.

@cgwalters cgwalters force-pushed the install-config-verity branch 2 times, most recently from 403be9a to 0cea6bc Compare February 1, 2025 03:12
@cgwalters cgwalters force-pushed the install-config-verity branch 2 times, most recently from d32c973 to cfad476 Compare February 3, 2025 14:33
@cgwalters
Copy link
Collaborator Author

So this is getting closer, but I'm seeing an issue where some zero-sized objects (different ones due to different selinux labels) don't have fsverity enabled. It must be an ostree bug, but I wasn't able to reproduce in a quick test.

@cgwalters cgwalters added the area/composefs Issues related to composefs label Mar 5, 2025
@cgwalters
Copy link
Collaborator Author

@cgwalters cgwalters force-pushed the install-config-verity branch from cfad476 to 64b2c82 Compare March 9, 2025 17:40
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 9, 2025
@cgwalters cgwalters force-pushed the install-config-verity branch from 64b2c82 to 856cb09 Compare March 13, 2025 17:22
libostree currently has a bug here with fsverity support;
in the consume case (which right now is always zero-sized
files because we don't hardlink them) it doesn't enable verity.

This would be an easy bug to fix in libostree.

But OTOH there's no real reason to set consume here either.
The main idea of consume is when one is operating on potentially
large files external to libostree, but most things here are
hardlinked, and what isn't is just the zero sized files.

Signed-off-by: Colin Walters <[email protected]>
For here doc support.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters force-pushed the install-config-verity branch 2 times, most recently from efa8594 to 8f2d2b5 Compare March 15, 2025 21:00
Key off the ostree prepare-root config to require fsverity
on all objects.

As part of this:

- Add a dependency on composefs-rs just for the fsverity querying
  APIs, and as prep for further integration.
- Add `bootc internals fsck`, which verifies the expected
  fsverity state.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters force-pushed the install-config-verity branch from 8f2d2b5 to ff952c3 Compare March 16, 2025 14:25
@cgwalters cgwalters marked this pull request as ready for review March 16, 2025 17:38
@cgwalters cgwalters changed the title wip: Install with fsverity Install with fsverity enabled + required Mar 16, 2025
@cgwalters cgwalters enabled auto-merge March 17, 2025 18:22
@cgwalters cgwalters requested review from jeckersb and jmarrero and removed request for allisonkarlitskaya March 18, 2025 21:11
@cgwalters
Copy link
Collaborator Author

TODO:

  • Docs for this
  • Support for upgrades (we should check post fetching, before reboot, check if new image enables fsverity, if so do it before rebooting)

Copy link
Contributor

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cgwalters cgwalters merged commit da468f5 into bootc-dev:main Mar 21, 2025
22 checks passed
@cgwalters
Copy link
Collaborator Author

@allisonkarlitskaya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/composefs Issues related to composefs area/install Issues related to `bootc install` documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants